<template>
  <view>
    <CustomPopup
      v-model="selectedValue"
      :api="{ url: '/addressQuery', method: 'POST' }"
      :keywordField="searchField"
      :textField="'name'"
      :valueField="'id'"
      :columns="[
        { prop: 'id', label: 'ID' },
        { prop: 'name', label: '名称' },
        { prop: 'address', label: '地址' },
      ]"
      :multi="false"
      label="地址"
      @change="handleAddressChange"
    />
  </view>
</template>

<script setup>
import { ref } from 'vue'
import CustomPopup from '@/components/CustomPopup/index.vue'

const selectedValue = ref('')
const searchField = ref('keyWord') // 可以根据后端接口动态修改

const handleAddressChange = (value) => {
  console.log('选择的地址:', value)
}
</script>
